gtkbox: Invalidate order on changes, even if the child is not visible
authorVincent Untz <vuntz@gnome.org>
Tue, 28 Jun 2011 09:47:37 +0000 (11:47 +0200)
committerVincent Untz <vuntz@gnome.org>
Thu, 30 Jun 2011 07:11:28 +0000 (09:11 +0200)
When we build the sibling path for the order, we do not skip hidden
children (since, quoting the comment, "we cannot reliably detect changes
in widget visibility"). So we need to invalidate the order when hidden
children are reordered and removed.

https://bugzilla.gnome.org/show_bug.cgi?id=652769

gtk/gtkbox.c

index f97a80d583e0597658c9797066343b95c4ba6596..b711a52aa5a23a20e7ec7986a7e16d5116e5351f 100644 (file)
@@ -1612,10 +1612,12 @@ gtk_box_reorder_child (GtkBox    *box,
   priv->children = g_list_insert_before (priv->children, new_link, child_info);
 
   gtk_widget_child_notify (child, "position");
+
+  gtk_box_invalidate_order (box);
+
   if (gtk_widget_get_visible (child)
       && gtk_widget_get_visible (GTK_WIDGET (box)))
     {
-      gtk_box_invalidate_order (box);
       gtk_widget_queue_resize (child);
     }
 }
@@ -1799,12 +1801,13 @@ gtk_box_remove (GtkContainer *container,
          g_list_free (children);
          g_free (child);
 
+         gtk_box_invalidate_order (box);
+
          /* queue resize regardless of gtk_widget_get_visible (container),
           * since that's what is needed by toplevels.
           */
          if (was_visible)
             {
-              gtk_box_invalidate_order (box);
              gtk_widget_queue_resize (GTK_WIDGET (container));
             }